const express = require('express');
const { User, Device } = require('../mongoose/Schema');
const { setkey, delKey, getKey } = require('../utils/redis');
const home = express.Router();
home.get("/deviceList", async (req, res)=>{
    let data = null;
    data = await getKey('home');
    if(data){
        return res.send(data);
    }
    data = await Device.find({});
    if(data){
        setkey('home', data);
        return res.send(data);
    }
    res.send('错误');
});

module.exports = home;